package com.pl.apache.dubbo.consumer.controller;

import com.pl.apache.dubbo.provider.api.EchoService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: pl
 * @Date: 2019/11/25 22:38
 * @Description:
 */
@RefreshScope
@RestController
public class EchoController {
    //使用@Reference引用服务
    @Reference(version = "1.0.0")
    private EchoService echoService;

    @Value("${user.name}")
    private String username;

    @GetMapping(value = "/echo/{params}")
    public String echoTest(@PathVariable String params){
            return echoService.echo(params)+" name is >>>>>>>>>" +username;
    }
}